MTRX.c

					
					/*
 * MTRX_functions.c
 *
 *  Created on: 9 θών. 2018 γ.
 *      Author: Bohdan
 */

#include "MTRX_functions.h"
#include "stm32f4xx_hal.h"
#include "stdlib.h"

/* Functions for creating 2d matrix. Just in case, i think.
 * Parameters:
 * 		rows - quantity of rows in future array
 * 		cols - quantity of columns in future array
 */
int16_t** create_matrix(uint8_t rows, uint8_t cols)
{
	int16_t** t = NULL;
    t = (int16_t**)malloc(sizeof(int16_t)*rows);

    for (uint8_t i=0; i<rows;i++)
    {
        t[i] = (int16_t*)malloc(sizeof(int16_t)*cols);
    }

    for(uint8_t i = 0; i < rows; i++)
    {
    	for(uint8_t j = 0; j < cols; j++)
    	{
    		t[i][j] = 0;
    	}
    }

    return t;
}